<template>
  <ElFormItem
    :label="titleText(options, item)"
    :prop="[childIndex, 'value']"
    :rules="{
      required: item.isRequired === 'Y',
      message: '请选择',
      trigger: 'change',
    }"
    class="flex_column"
  >
    <p v-if="options.showDesc" class="desc f12 mb10">
      {{ options.description }}
    </p>
    <ElSelect
      v-model="item.value"
      :disabled="type === 'view' || options.disabled"
      :multiple="options.isMultiple"
      class="pc_w300"
      placeholder="请选择"
      @change="onChange"
    >
      <ElOption
        v-for="option in item.itemOptResList"
        :key="option.itemOptionId"
        :label="option.optionName"
        :value="option.optionName"
      ></ElOption>
    </ElSelect>
  </ElFormItem>
</template>

<script setup>
import { titleText } from "@/utils/common.js";
import { ElFormItem, ElOption, ElSelect } from "element-plus";
import { } from "vue";

//defineOptions({ name: "PCTradeUnion" });

const { item, type, index, childIndex } = defineProps([
  "item",
  "type",
  "index",
  "childIndex",
]);
const emits = defineEmits(["change"]);
const { options } = JSON.parse(item.vformJson);
// 传递值改变后
const onChange = () => emits("change", item);
</script>